import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 引用node提供的内置模块path,可以获取绝对路径
import path from 'path';

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
    //src文件目录配置别名
    resolve: {
      alias: {
        //安装一下ts的依赖包
        //npm i @types/node --save-dev
        "@": path.resolve(__dirname, "src")
      }
    },
    //配置代理跨域
    server: {
      proxy: {
        '/api': {
          // target: 'http://127.0.0.1:52001',
          target: 'http://1.92.144.75/xmyj-test',
          // target: 'http://192.168.52.151:52001',
          // target: 'https://www.ccat.ink',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/,''),
        },
      }
    }
})
